#ifndef AUTOMAT_H_
#define AUTOMAT_H_

#include "TType.h"

// Vorrausdeklartion wegen zyklischer abh�ngigkeit
class IState;
class State0;
class State1;

/**
 * Automat
 */
class Automat {
public:
	Automat();
	~Automat();
	void setCurrentState(IState* state);
	void readChar(char c);
	void makeToken(TTypes::TType t);
private:
	IState* mCurrentState;
	State0* state0;
	State1* state1;
};

/**
 * State interface fordert read()
 */
class IState {
public:
	IState() {}
	virtual ~IState() {};
	virtual void read(Automat* automat, char c) = 0;
};

class State0 : public IState{
private:
	static State0* instance;
	State0() {}
	~State0() {}
public:
	static State0* getInstance();
	void read(Automat* automat, char c);
};

class State1 : public IState{
private:
	static State1* instance;
	State1(){}
	~State1() {}
public:
	static State1* getInstance();
	void read(Automat* automat, char c);
};

class State2 : public IState{
private:
	static State2* instance;
	State2(){}
	~State2() {}
public:
static State2* getInstance();
	void read(Automat* automat, char c);
};

class State3 : public IState{
private:
	static State3* instance;
	State3(){}
	~State3() {}
public:
static State3* getInstance();
	void read(Automat* automat, char c);
};

#endif /* AUTOMAT_H_ */
